package com.xnchat.pro.dataStructure;

/**
 * @author 我就随便写写
 */
public class LinkedListStack {
    private static class Node {
        private char value;//存放值
        private Node nextNode;//下个节点
        private Node previousNode;//上个节点

    }

    private Node point = null;

    //peek
    public char peek() {
        return point == null ? '\0' : point.value;
    }

    //pop
    public char pop() {
        if (point == null) {
            return '\0';
        }
        char returnValue = point.value;
        point = point.nextNode;
        return returnValue;
    }

    //push
    public char push(char value) {
        Node node = new Node();
        node.nextNode = point;
        node.value = value;
        point = node;
        return value;
    }
}
